/**
 * 频道请求模块
 */
import { request } from '@/utils/request'

/**
 * 获取所有频道列表
 * @return Promise
 */
export const getAllChannels = () => {
  return request({
    method: 'GET',
    url: '/v1_0/channels'
  })
}

/**
 * 添加频道
 * @data channels{Array} (
 *  @param id 频道id
 *  @param seq 添加频道的排列序号 list.length)
 */
export const addUserChannel = channel => request({
  method: 'PATCH',
  url: '/v1_0/user/channels',
  data: {
    channels: [channel]
  }
})

/**
 * 删除用户指定频道
 */
export const deleteUserChannel = channelId => {
  return request({
    method: 'DELETE',
    url: `/v1_0/user/channels/${channelId}`
  })
}
